package compilers.symbolTable;

import compilers.AST.expression.Expression;
import compilers.AST.types.TypeSpecifier;

public class SymbolTableArrayElement extends SymbolTableElement {
	
	private boolean fConstant;

	public SymbolTableArrayElement(String identifier, TypeSpecifier type, int nodeId, int lineNr) {
		fIdentifier = identifier;
		fType = type;
		fConstant = false;
		fNodeId = nodeId;
		fLineNr = lineNr;
	}
	
	public SymbolTableArrayElement(String identifier, TypeSpecifier type, boolean constant, int nodeId, int lineNr) {
		fIdentifier = identifier;
		fType = type;
		fConstant = constant;
		fNodeId = nodeId;
		fLineNr = lineNr;
	}
	
	public void print(int identLevel) {
		String result = "Array (" + fIdentifier + ", " + fType.getTypeName() + ", " + fMemoryAddress;
		if (fConstant) {
			result += ", constant";
		}
		result += ")";
		println(identLevel, result);
	}
	
	public boolean isConstant() {
		return fConstant;
	}
}
